//
//  CoursePageModel.m
//  ShowYork
//
//  Created by hxh on 2020/8/31.
//  Copyright © 2020 hxh. All rights reserved.
//

#import "LessonPageModel.h"
#import "LessonPlanModel.h"
@implementation LessonPageModel

+(NSDictionary *)mj_objectClassInArray{
    return @{@"recommend":[LessonPageItemModel class],@"hot":[LessonPageItemModel class]};
}
- (void)updateCourseStatusWithSelectedArray:(NSArray *)selectedArr{
    if (selectedArr.count == 0) {
        return;
    }
    [self updateCourseStatusWithTargetArray:self.hot andSourceArray:selectedArr];
    [self updateCourseStatusWithTargetArray:self.recommend andSourceArray:selectedArr];
}

- (void)updateCourseStatusWithTargetArray:(NSArray *)targetArray andSourceArray:(NSArray *)sourceArray{
    [targetArray enumerateObjectsUsingBlock:^(LessonPageItemModel * _Nonnull targetObj, NSUInteger idx, BOOL * _Nonnull stop) {
        [sourceArray enumerateObjectsUsingBlock:^(LessonPlanModel *_Nonnull sourceObj, NSUInteger idx, BOOL * _Nonnull stop) {
            if ([targetObj.id isEqualToNumber:sourceObj.id]) {
                targetObj.isSeleted = YES;
            }
        }];
    }];
}

@end
